import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 04 - 18
 * Time: 12:40
 */
//给定一个整型数组nums和一个整数目标值target，在该数组中找出和为目标值target的那两个整数，并返回它们的数组下标
public class test3 {
    public static int[] function(int[] num, int target) {
        int[] arr1 = new int[6];
        for (int i = 0; i < num.length; i++) {
            for (int j = i + 1; j < num.length; j++) {
                if(num[i] + num[j] == target) {
                    arr1[0] = i;
                    arr1[1] = j;
                }
            }
        }
        return arr1;
    }
    public static void main(String[] args) {
        int[] num = new int[6];
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < num.length; i++) {
            num[i] = scanner.nextInt();
        }
        scanner.nextLine();//把回车读走
        int target = scanner.nextInt();
        System.out.println(Arrays.toString(function(num, target)));
    }
}
